<!DOCTYPE html>
<html lang="en" dir="ltr">
    <head>
        <meta charset="utf-8">
        <title></title>
        <script src="./lib/vue.js"></script>
        <script src="./lib/vue-resource.js"></script>
    </head>
    <body>
        <div id="app">
            <input type="button" value="get请求" @click="getInfo">
            <input type="button" value="post请求" @click="postInfo">
            <input type="button" value="jsonp请求" @click="jsonpInfo">
        </div>

        <script>
            var vm = new Vue({
                el: '#app',
                data: {

                },
                methods: {
                    getInfo() {
                        this.$http.get('http://vue.studyit.io/api/getlunbo').then(function(result){
                            console.log(result);
                        })
                    },
                    postInfo() {
                        this.$http.post('http://vue.studyit.io/api/post',{},{emulateJSON: true})
                        .then(result => {
                            console.log(result);
                        })
                    },
                    jsonpInfo() {
                        this.$http.jsonp('http://vue.studyit.io/api/jsonp').then(result => {
                            console.log(result.body);
                        })
                    }
                }
            });

        </script>
    </body>
</html>
